home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1991 …esperately Seeking Seven / Desperately Seeking Seven.2mg / Dev.CD.8 / Essentials / Tools / DTS.Samples / SC24Teach / Teach.asm / UEvent.asm < prev    next >
Encoding:
Assembly Source File  |  1990-05-25  |  5.0 KB  |  214 lines  |  [04] ASCII Text (0x0000)

  1. ***********************************************************************
  2. *
  3. * teach uevent.aii -- Version 3.0 
  4. *
  5. * Copyright (c)
  6. * Apple Computer, Inc.  1986-1990
  7. * All Rights Reserved.
  8. *
  9. * Developer Technical Support Apple II Sample Code
  10. *
  11. * This file contains the teach program.
  12. *
  13. ***********************************************************************
  14.  
  15.                case on
  16.  
  17.                copy 2/ainclude/e16.window
  18.                copy teach.equ
  19.  
  20.                mcopy macros/uevent.macros
  21.  
  22.                longi on
  23.                longa on
  24.  
  25. ***********************************************************************
  26.  
  27. enableDAItems  start
  28.  
  29.                pea UndoItem
  30.                _EnableMItem
  31.                pea CloseItem
  32.                _EnableMItem
  33.                pea $FF7F
  34.                pea EditMenuID
  35.                _SetMenuFlag
  36.                rts
  37.  
  38.                end
  39.  
  40. ***********************************************************************
  41.  
  42. enableAppItems start
  43.  
  44.                pea SelectAllItem
  45.                _EnableMItem
  46.                pea CloseItem
  47.                _EnableMItem
  48.                pea SaveItem
  49.                _EnableMItem
  50.                pea SaveAsItem
  51.                _EnableMItem
  52.                pea PageSetupItem
  53.                _EnableMItem
  54.                pea PrintItem
  55.                _EnableMItem
  56.                pea $FF7F
  57.                pea SizeMenuID
  58.                _SetMenuFlag
  59.                pea $FF7F
  60.                pea StyleMenuID
  61.                _SetMenuFlag
  62.                pea $FF7F
  63.                pea FontMenuID
  64.                _SetMenuFlag
  65.                pea $FF7F
  66.                pea EditMenuID
  67.                _SetMenuFlag
  68.                rts
  69.  
  70.                end
  71.  
  72. ***********************************************************************
  73.  
  74. disableDAItems start
  75.  
  76.                pea UndoItem
  77.                _DisableMItem
  78.                rts
  79.  
  80.                end
  81.  
  82. ***********************************************************************
  83.  
  84. disableAppItems start
  85.  
  86.                pea $0080
  87.                pea EditMenuID
  88.                _SetMenuFlag
  89.                pea $0080
  90.                pea FontMenuID
  91.                _SetMenuFlag
  92.                pea $0080
  93.                pea StyleMenuID
  94.                _SetMenuFlag
  95.                pea $0080
  96.                pea SizeMenuID
  97.                _SetMenuFlag
  98.                pea SaveItem
  99.                _DisableMItem
  100.                pea SaveAsItem
  101.                _DisableMItem
  102.                pea PageSetupItem
  103.                _DisableMItem
  104.                pea PrintItem
  105.                _DisableMItem
  106.                pea SelectAllItem
  107.                _DisableMItem
  108.                rts
  109.  
  110.                end
  111.  
  112. ***********************************************************************
  113. *
  114. * CheckFrontW
  115. *
  116. * This routine checks the front window to see if any changes need
  117. * to be made to the menu items.
  118. *
  119. * We do this so that the edit items are only active when a desk
  120. * accessory is active.
  121. *
  122. checkFrontW    start
  123.  
  124.                DefineStack
  125.  
  126. wptr           long                     ;Must be at 1,s.
  127.  
  128. saveDPage      word
  129. returnAddr     word
  130.  
  131. ******************
  132.  
  133.                phd                      ;Save directPage register.
  134.                pha                      ;Make space for wptr.
  135.                pha
  136.                tsc
  137.                tcd                      ;Set directPage register.
  138.  
  139.                _FrontWindow             ;wptr is the result space.
  140.  
  141.                lda wptr                 ;Same top window?
  142.                ldx wptr+2
  143.                cmp lastWindow
  144.                bne newTop
  145.                cpx lastWindow+2
  146.                beq exit
  147.  
  148. newTop         sta lastWindow
  149.                stx lastWindow+2
  150.                ora wptr+2
  151.                bne thereIsATop
  152.  
  153.                jsr disableDAItems
  154.                jsr disableAppItems
  155.                pea CloseItem
  156.                _DisableMItem
  157.                brl drawMenuBar
  158.  
  159. thereIsATop    pha
  160.                pei wptr+2
  161.                pei wptr
  162.                _GetSysWFlag
  163.                pla
  164.                beq ourWindow
  165.                jsr disableAppItems
  166.                jsr enableDAItems
  167.                brl drawMenuBar
  168.  
  169. ourWindow      jsr disableDAItems
  170.                jsr enableAppItems
  171.  
  172. drawMenuBar    _DrawMenuBar
  173.  
  174. exit           pla                      ;Remove local space.
  175.                pla
  176.                pld                      ;Restore directPage register.
  177.                rts
  178.  
  179.                end
  180.  
  181. ***********************************************************************
  182. *
  183. * mainEvent
  184. *
  185. * This is the main part of the program.  The program cycles in this
  186. * loop until the user choose select.
  187. *
  188. mainEvent      start
  189.  
  190. loopLongAndHard jsr checkFrontW
  191.  
  192.                pha
  193.                pea $FFFF
  194.                PushLong #event
  195.                _TaskMaster
  196.                pla
  197.                cmp #wInGoAway
  198.                bne aa
  199.                jsr doCloseTop
  200.                brl next
  201.  
  202. aa             cmp #wInSpecial
  203.                beq ab
  204.                cmp #wInMenuBar
  205.                bne next
  206. ab             jsr doMenu
  207.  
  208. next           lda quitFlag
  209.                beq loopLongAndHard
  210.  
  211.                rts
  212.  
  213.                end
  214.